#coding:utf-8

motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)

#修改元素列表
motorcycles[0] = 'harley'
print(motorcycles)

#添加元素
motorcycles.append('ducati')
print(motorcycles)

motorcycles1 = []
motorcycles1.append('honda')
motorcycles1.append('yamaha')
motorcycles1.append('suzuki')
print(motorcycles1)

#插入元素
motorcycles1.insert(0, 'ducati')
print(motorcycles1)

#删除元素
del motorcycles1[0]
print(motorcycles1)

#pop()方法删除元素
popped_motocycles1 = motorcycles1.pop()
print(motorcycles1)
print(popped_motocycles1)

#例子
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
last_motorcycles = motorcycles.pop()
print("The last motorecycle I ownde was a " + last_motorcycles.title() + ".")
print(motorcycles)

motorcycles = ['honda', 'yamaha', 'suzuki']
first_owned = motorcycles.pop(0)
print('The first motorcycle I owned was a ' + first_owned.title() + '.')
print(motorcycles)


#删除任意位置的元素
motorcycles = ['honda', 'yamaha', 'suzuki', 'ducati']
print(motorcycles)

# motorcycles.remove('honda')
# print(motorcycles)

# motorcycles.remove('yamaha')
# print(motorcycles)

too_expensive = 'honda'
motorcycles.remove(too_expensive)
print(motorcycles)
print("\nA " + too_expensive.title() + " is to expensive for me.")




